
// 这个模块是关于本地存储的工具模块
const TOKEN_KEY = 'hm-mobile-80-tokenInfo'
const HISTORY_KEY = 'hm-mobile-80-history'
// 存储token 存的时候传递参数
export const setToken = (tokenInfo) => {
  localStorage.setItem(TOKEN_KEY, JSON.stringify(tokenInfo))
}
// 获取token 取的时候记得return
export const getToken = () => {
  return JSON.parse(localStorage.getItem(TOKEN_KEY)) || {}
}
// 移除token
export const removeToken = () => {
  localStorage.removeItem(TOKEN_KEY)
}

// 存储历史
export const setHistory = (history) => {
  localStorage.setItem(HISTORY_KEY, JSON.stringify(history))
}
// 获取历史
export const getHistory = () => {
  return JSON.parse(localStorage.getItem(HISTORY_KEY)) || []
}
// 移除历史
export const removeHistory = () => {
  return localStorage.removeItem(HISTORY_KEY)
}
